<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Base extends CI_Controller {
	public function __construct() {
		parent::__construct();
	}
}



class Home_Controller extends CI_Controller{
    public function __construct( ){
        parent::__construct();
        $this->load->model('Member_incutry_model');
    }
    
    public function layout_view($tpl_url,$page_data = array() ){
    	//$page_data['online_user'] = $this->logistics_customer_online_user();
    	if(!isset($page_data['top_menu']) || !$page_data['top_menu']){
    		$page_data['top_menu'] = 'home';
    	}
    	$page_data['member_incutry_list'] = $this->Member_incutry_model->search(array('pinyin !='=>""));
    	$page_data['sub_page']=$this->load->view($tpl_url,$page_data,true);
    	$this->load->view('home/layout_view',$page_data);
    }
    
    public function weixin_layout_view($tpl_url,$page_data = array() ){
    	//$page_data['online_user'] = $this->logistics_customer_online_user();
    	
    	$page_data['sub_page']=$this->load->view($tpl_url,$page_data,true);
    	$this->load->view('home/weixin_layout_view',$page_data);
    }
    public function render_view($tpl,$data,$is_true = false){
    	if($is_true){
    		return $this->load->view($tpl,$data,true);
    	}else{
    		$this->load->view($tpl,$data);
    	}
    }
    
    /**
     * 后台分页
     * @param unknown $url  地址
     * @param unknown $total 总共多少条记录
     * @param unknown $limit
     */
    public function pager($url, $total, $limit = 10){
    	$pager_config = array();
    	$pager_config['base_url'] = $url;
    	$pager_config['total_rows'] = $total;
    	$pager_config['per_page'] = $limit;
    	$pager_config['page_query_string'] = TRUE;
    	$pager_config['reuse_query_string'] = TRUE;
    	$this->pagination->initialize($pager_config);
    	$html = $this->pagination->create_links();
    	$start_page = $this->pagination->get_offset();
    	return array('total'=>$total, 'perpage'=>$limit, 'start_page'=>$start_page, 'pager_html'=>$html);
    }
}

